Ext.namespace("SMeeting");

SMeeting.View = function(p) {
	this.parentWin=p
	
	this.hdSuperviseId = new Ext.form.Hidden({name:'superviseId'});
	
	this.txtTitle = new Ext.form.TextField({
        fieldLabel: '会议名称',
        width: 540,
        name:'superviseTitle',
        disabled:true
    });
	this.txtDispatchDept = new Ext.form.TextField({
		fieldLabel: '发文部门',
		name:'dispatchDeptName',
		disabled:true,
		width: 110
	});
	this.txtAuditor = new Ext.form.TextField({
		fieldLabel: '批示人',
		name:'auditor',
		disabled:true,
		width: 110
	});
	this.txtDocDate = new Ext.form.TextField({
    	fieldLabel: '批示日期',
    	name:'auditDate',
		disabled:true,
		width:110
	});
	this.txtNotion = new Ext.form.TextArea({
		fieldLabel: '领导批示意见',
		name:'notion',
		width: 550,
		disabled:true,
		height: 30
	});
    this.txtPrincipal = new Ext.form.TextField({
		fieldLabel: '阅处负责人',
		name:'managerName',
		disabled:true,
		width: 110
	});
	this.txtInspector = new Ext.form.TextField({
		fieldLabel: '阅处人',
		name:'inspectorName',
		disabled:true,
		width: 110
	});
	this.txtInspectDate =  new Ext.form.TextField({
    	fieldLabel: '阅处日期',
    	disabled:true,
    	name:'completeDate',
    	width: 110,
		format: 'Y-m-d'
	});
	this.txtContent = new Ext.form.TextArea({
		fieldLabel: '发文内容',
		width:550,
		height:30,
		name:'superviseContent',
		disabled:true
	});
	this.txtReceiveDept = new Ext.form.TextField({
		fieldLabel: '收文部门',
		name:'receiveDeptName',
		disabled:true,
		width: 110
	});
	this.txtFulfill = new Ext.form.TextArea({
		fieldLabel: '落实情况',
		name:'fulfill',
		disabled:true,
		width: 550,
		height:35
	});
	
	this.form = new Ext.FormPanel({
		bodyStyle: 'padding: 5px 5px 0',
        labelWidth: 70,
        labelAlign: 'right',
        region:'north',	
		height: 230,
		frame:true,
		items: [ this.txtTitle,
        	{ layout: 'column', border: false, defaults: {layout: 'form', border: false},
	        	items: [ { columnWidth: .33, items: [this.txtDispatchDept] },
	        	         { columnWidth: .33, items: [this.txtAuditor]} ]
	    },this.txtNotion,{ layout: 'column', border: false, defaults: {layout: 'form', border: false},
	        	items: [ { columnWidth: .33, items: [this.txtDocDate]},
	        	         { columnWidth: .33, items: [this.txtInspector] },
	        	         { columnWidth: .33, items: [this.txtPrincipal]} ]
	    },this.txtContent,{ layout: 'column', border: false, defaults: {layout: 'form', border: false},
	        	items: [ { columnWidth: .33, items: [this.txtInspectDate]},
	        	         { columnWidth: .33, items: [this.txtReceiveDept]} ]
	    },this.txtFulfill]
    });
	this.store2 = new Ext.data.JsonStore({
	    url: '../superviseMeeting/listMeetingTask.form?timesnap=' + Date.parse(new Date()),
	    root: 'result',
	    totalProperty: 'total',
        remoteSort: true,
	    fields: ['auditId','superviseId','auditContent','auditorId','auditDate',
	    'auditState','inspectorId','inspectorName','dispatchDate','taskContent','backContent','completeDate',
	    'content','auditorName','finishDate','taskStatus']
	});
	//this.store.setDefaultSort('taskFeedbackId', 'desc');
	this.renderTaskStatus = function(value){
		return OMS.TASKSEXESTATUS[value];
	}
	this.renderState = function(value){
		return OMS.TASKSTATUS[value];
	};
	this.renderSend = function(value){
		
	}
	this.columns2 = [	
		{header: '派发ID', sortable: true, align: 'right',width: 20,hidden:true,dataIndex: 'auditId'},
		{header: '督办ID', sortable: true, align: 'right',width: 20,hidden:true,dataIndex: 'superviseId'},
		{header: '派发意见', sortable: true, align: 'center',width: 20,hidden:true,dataIndex: 'auditContent'},
		{header: '阅处人ID', sortable: true, align: 'center',width: 20,hidden:true,dataIndex: 'auditorId'},
		{header: '阅处人', sortable: true, align: 'center',width: 20,dataIndex: 'auditorName'},
		{header: '任务派发时间', sortable: true, align: 'right',width: 20,dataIndex: 'dispatchDate'},
		{header: '反馈日期', sortable: true, align: 'right',width: 20,hidden:true,dataIndex: 'auditDate'},
		{header: '完成时间', sortable: true, align: 'right',width: 30,dataIndex: 'finishDate'},
		{header: '反馈状态', sortable: true, align: 'center',width: 20,dataIndex: 'taskStatus',renderer:this.renderState},
		{header: '阅处人id', sortable: true, align: 'center',width: 20,hidden:true,dataIndex: 'inspectorId'},
		{header: '阅处人名称', sortable: true, align: 'center',width: 20,hidden:true,dataIndex: 'inspectorName'},		
		{header: '任务要求', sortable: true, align: 'center',width: 30,dataIndex: 'taskContent'},
		{header: '反馈情况', sortable: true, align: 'center',width: 30,dataIndex: 'backContent'},
		{header: '完成期限', sortable: true, align: 'right',width: 20,hidden:true,dataIndex: 'completeDate'},
		{header: '操作', align: 'center',width: 30,dataIndex: 'auditId',
			renderer:function(value, cellmeta, record, rowIndex, columnIndex, store){
				return '<a href="javascript:thiz.onFeedBack('+value+')"></a>&nbsp;&nbsp;<a href="javascript:thiz.onSendMsg('+"'"+record.data["taskContent"]+"'"+','+value+')"></a>';
			}

		}
	];
	this.grid2 = new Ext.grid.EditorGridPanel({
		title:'任务派发情况',
		region: 'center',
		cm: new Ext.grid.ColumnModel(this.columns2),
		store:this.store2,
		height: 180,
		viewConfig: { forceFit: true },
        collapsible:true
	});	
	SMeeting.View.superclass.constructor.call(this, {
		title: '查看会议',        
        width:700,
		height:420,
		resizable: false,
        modal: true,
        autoScroll: true,
		closeAction:'hide',
        items: [this.form,this.grid2],
        buttons: [{
            text: '关闭',
            scope: this,
            handler: function() {
	        	this.hide();
        	}
        }],
        buttonAlign:'center'
	});
};
Ext.extend(SMeeting.View, Ext.Window, {
	initWin:function(data){		
		this.form.getForm().setValues(data);
		this.grid2.store.load({
			params:{superviseId:data.superviseId}
		});	
	}
});